package com.zhanghuang.springbootstudy01.configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfig  implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //  loalhost:9999/mymvc   --> index.html
        registry.addViewController("/mymvc").setViewName("test2");
        registry.addViewController("/test2").setViewName("test2");
        // loalhost:9999/redirect/myMvc   -->重定向
        registry.addRedirectViewController("redirect/myMvc","www.baidu.com");
    }
}
